package com.gis.enums;

import lombok.Getter;

@Getter
public enum QualityReportEnum {

    FIRST_CLASS(1, "第一类"),
    SECOND_CLASS(2, "第二类"),
    THIRD_CLASS(3, "第三类"),
    FOURTH_CLASS(4, "第四类"),
    FIFTH_CLASS(5, "劣四类"),
    NULL_CLASS(-1, "无数据"),

    // 灾害等级
    STATE_HAPPENED(11, "发生"),
    STATE_NOHAPPEN(12, "不发生");

    private final int code;
    private final String name;

    QualityReportEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }
    public static QualityReportEnum fromCode(int code) {
        for (QualityReportEnum enumValue : values()) {
            if (enumValue.getCode() == code) {
                return enumValue;
            }
        }
        throw new IllegalArgumentException("Invalid code: " + code);
    }
}
